package com.central.datax.plugin.writer.hivewriter;

import com.alibaba.datax.common.spi.ErrorCode;

/**
 * @author Tindy
 * @date 2022/3/8
 * @describe
 */
public enum HiveWriterErrorCode implements ErrorCode {
    BAD_CONFIG_VALUE("HiveReader-00", "您配置的值不合法."),
    PATH_NOT_FIND_ERROR("HiveReader-01", "您未配置path值"),
    DEFAULT_FS_NOT_FIND_ERROR("HiveReader-02", "您未配置defaultFS值"),
    ILLEGAL_VALUE("HiveReader-03", "值错误"),
    CONFIG_INVALID_EXCEPTION("HiveReader-04", "参数配置错误"),
    REQUIRED_VALUE("HiveReader-05", "您缺失了必须填写的参数值."),
    NO_INDEX_VALUE("HiveReader-06", "没有 Index"),
    MIXED_INDEX_VALUE("HiveReader-07", "index 和 value 混合"),
    EMPTY_DIR_EXCEPTION("HiveReader-08", "您尝试读取的文件目录为空."),
    PATH_CONFIG_ERROR("HiveReader-09", "您配置的path格式有误"),
    READ_FILE_ERROR("HiveReader-10", "读取文件出错"),
    MALFORMED_ORC_ERROR("HiveReader-10", "ORCFILE格式异常"),
    FILE_TYPE_ERROR("HiveReader-11", "文件类型配置错误"),
    FILE_TYPE_UNSUPPORT("HiveReader-12", "文件类型目前不支持"),
    KERBEROS_LOGIN_ERROR("HiveReader-13", "KERBEROS认证失败"),
    READ_SEQUENCEFILE_ERROR("HiveReader-14", "读取SequenceFile文件出错"),
    READ_RCFILE_ERROR("HiveReader-15", "读取RCFile文件出错"),
    CONN_CLOSE_ERROR("HiveReader-16", "hive-conn关闭出错"),
    UNSUPPORTED_TYPE("HiveReader-17", "不支持的数据库类型. 请注意查看 DataX 已经支持的数据库类型以及数据库版本."),
    QUERY_ERROR("HiveReader-18","sql查询出错" ),
    CONN_DB_ERROR("HiveReader-19", "连接数据库失败. 请检查您的 账号、密码、数据库名称、IP、Port或者向 DBA 寻求帮助(注意网络环境)."),
    CONNECT_HDFS_IO_ERROR("HiveReader-20", "与HDFS建立连接时出现IO异常."),
    HDFS_RENAME_FILE_ERROR("HiveReader-21", "将文件移动到配置路径失败."),
    WRITE_FILE_IO_ERROR("HiveReader-22", "您配置的文件在写入时出现IO异常."),
    COLUMN_REQUIRED_VALUE("HiveReader-23","您column配置中缺失了必须填写的参数值." );


    private final String code;
    private final String description;

    private HiveWriterErrorCode(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getCode() {
        return this.code;
    }

    @Override
    public String getDescription() {
        return this.description;
    }

    @Override
    public String toString() {
        return String.format("Code:[%s], Description:[%s]. ", this.code,
                this.description);
    }
}
